package workload

import (
	k8sclient "k8s_gui_client/k8s/client"
)

//cronjob list
func GetCronJobs(namespace string  ) (map[string]interface{},error){
//todo 区分不同版本的区别
	if namespace  !=  "" {
	   return  k8sclient.CurrentK8sApiClient.GetAPI("/apis/batch/v1beta1/namespaces/"+namespace+"/cronjobs")
	} else {
	   return  k8sclient.CurrentK8sApiClient.GetAPI("/apis/batch/v1beta1/cronjobs")
		
	}
	
	
}

func CronJobURL(namespace string, name string) string {
	return "/apis/batch/v1beta1/namespaces/" + namespace + "/cronjobs/" + name
}

func GetCronJobYaml(namespace string,name string) (string ,error){
    return k8sclient.CurrentK8sApiClient.GetAPIAsYaml(CronJobURL(namespace,name))
}